<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>后台管理-登录</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<link rel="stylesheet" href="/resources/src/css/admin/login.css"/>
	</head>
	<body>
		<div class="full-screen">
			<div class="wrapper">
				<div class="content">
					<div class="con-header">
						<img src="/resources/src/images/vchello_saas_logo.png" height="100%" width="auto" />
					</div>
					<div class="con-body">
						<div class="form">
							<div class="input-row">
								<input type="text" id="name" name="name" placeholder="请输入用户名"/>
							</div>
							<div class="input-row">
								<input type="password" id="password" name="password" placeholder="请输入密码"/>
							</div>
							<!--<div class="input-row clearfix">
								<input type="text" id="code" name="code" placeholder="请输入验证码"/>
								<img src="" alt="验证码" id="VerifyReg"/>
							</div>-->
							<div class="login">登录</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		<script src="/resources/src/js/jquery-2.1.4.js"></script>
		<script src="/resources/src/js/jquery.nicescroll.js"></script>
		<script src="/resources/src/js/admin/main.js"></script>
		<script>
			$(function(){
				
				//动态验证
				$(".form").on("keyup","input",function(){
					var value=$(this).val().trim();
					var id=$(this).attr("id");
					
					if(id==="name"){
						if(value=="" || value==null){
							Global.showTip("#name","请输入用户名！");
						}
						else if(!Re.name.test(value)){
							Global.showTip("#name","用户名格式错误！");
						}
						else{
							$(this).removeClass("errBorder");
							$("#name").parents(".input-row").next(".err").remove();
						}
					};
					
					if(id==="password"){
						if(value=="" || value==null){
							Global.showTip("#password","请输入密码！");
						}
						else if(!Re.password.test(value)){
							Global.showTip("#password","密码格式错误！");
						}
						else{
							$(this).removeClass("errBorder");
							$("#password").parents(".input-row").next(".err").remove();
						}
					};
					/*
					if(id==="code"){
						if(value=="" || value==null){
							Global.showTip("#code","请输入验证码！");
						}
						else if(value !== Global.code ){
							Global.showTip("#code","验证码错误！");
						}
						else{
							$(this).removeClass("errBorder");
							$("#code").parents(".input-row").next(".err").remove();
						}
					};*/

				});
				
				//登录
				$(".login").on("click",function(){
					var name=$("#name").val().trim();
					var passwords=$("#password").val().trim();
					//var code=$("#code").val().trim();
					var flag=true;
					
					if(name=="" || name==null){
						Global.showTip("#name","请输入用户名！");
						flag=false;
					}
					else if(!Re.password.test(passwords)){
						Global.showTip("#name","用户名格式错误！");
						flag=false;
					};
					
					if(passwords=="" || passwords==null){
						Global.showTip("#password","请输入密码！");
						flag=false;
					}
					else if(!Re.password.test(passwords)){
						Global.showTip("#password","密码格式错误！");
						flag=false;
					};
					
					/*
					if(code=="" || code==null){
						Global.showTip("#code","请输入验证码！");
						flag=false;
					}
					else if(code!==Global.code){
						Global.showTip("#password","验证码错误！");
						flag=false;
					};*/
					
					//如果验证通过，发送表单数据
					if(flag){
						/*
						$.ajax({
							type:"post",
							url:"",
							data:{"name":name, "password":passwords},
							dataType:"json",
							success:function(data){
								//do
							}
						});
						*/
					}
				});

			});
		</script>
	</body>
</html>